﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using _0812159_0812164.dao;

namespace _0812159_0812164
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text.ToString();
            string password = txtPassword.Text.ToString();
            string repassword = txtRepassword.Text.ToString();

            if (UserDAO.kiemtratontai(username) == 1)
            {
                lblMessage.Text = "Tài khoản đã tồn tại";
                return;
            }

            if (UserDAO.dangky(username, password))
            {
                lblMessage.Text = "Đăng ký thành công";
                Session["username"] = username;
                Response.Redirect("Default.aspx");                
            }
        }
    }
}
